/* eslint-disable */
import { createHtmlSpace } from "@/assets/js/utils";

export const ALPHA_LIST = [
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G",
  "H",
  "I",
  "J",
  "K",
  "L",
  "M",
  "N",
  "O",
  "P",
  "Q",
  "R",
  "S",
  "T",
  "U",
  "V",
  "W",
  "X",
  "Y",
  "Z"
];

// 纸张及分栏尺寸数据
export const PAPER_SIZE_MAP = (() => {
  const A4Col1Config = {
    width: 210,
    height: 297,
    leftPadding: 12.8,
    topPadding: 17,
    contentWidth: 210 - 2 * 12.8,
    contentHeight: 297 - 2 * 17
  };
  const A3Col3CommonConfig = {
    width: 420 / 3,
    height: 297,
    topPadding: 17,
    contentHeight: 297 - 2 * 17
  };
  return {
    A4: {
      width: 210,
      height: 297,
      "col-1": [A4Col1Config]
    },
    A3: {
      width: 420,
      height: 297,
      "col-2": [A4Col1Config, A4Col1Config],
      "col-3": [
        {
          ...A3Col3CommonConfig,
          leftPadding: 20,
          contentWidth: 118
        },
        {
          ...A3Col3CommonConfig,
          leftPadding: 2,
          contentWidth: 136
        },
        {
          ...A3Col3CommonConfig,
          leftPadding: 2,
          contentWidth: 118
        }
      ]
    }
  };
})();

// 跟题目有关的尺寸数据
export const QUESTION_SIZE_MAP = {
  titleHeight: 5, // 题目标题的默认高度
  splitHeight: 5, // 分割题目的空白高度
  cardHead: {
    height: 88 // 85,
  },
  select: {
    itemHeight: 5.4, // 单选题的高度
    splitHeight: 5.0, // 单选题大行间隔
    paddingTopHeight: 2.5, // 单选题上下留的空间

    caseHeight: 3.2, // 2.8, // 单选题一个选项的高度
    caseWidth: 4.6, // 4.2, // 单选题一个选项的宽度
    idWidth: 8.0, // 单选题题号的宽度
    caseSplitWidth: 2.0, // 2.4, // 单选题选项间的间隔
    itemSplitWidth: 5.5 // 单选题间的间隔
  },
  blank: {
    itemHeight: 10.0, // 填空题高度
    paddingBottomHeight: 4.0 // 填空题下边留的空间
  },
  answer: {
    itemHeight: 50.0 // 解答题高度
  },
  en_article: {
    itemHeight: 10.0, // 英语作文每行的高度
    paddingBottomHeight: 4.0 // 英语作文题下边留的空间
  },
  cn_article: {
    itemHeight: 8.0, // 语文作文单元格高度
    splitHeight: 2.0 // 分割高度
  }
};

// 题组常量
export const QUESTION_GROUP_TYPE_MAP = {
  CARD_HEAD: "card-head", // 标题、准考证等头部信息
  BLANK_SPLIT: "blank-split", // 分割题目的空白
  FORBID_BLANK: "forbid-blank", // 禁止作答区
  SELECT: "select", // 包括判断/单选/多选
  BLANK: "blank", // 填空
  ANSWER: "answer", // 解答
  EN_ARTICLE: "en-article", // 英语作文
  CN_ARTICLE: "cn-article" // 语文作文
};

// 题型常量
export const QUESTION_TYPE_MAP = {
  JUDGE: "judge", // 判断
  SINGLE_SELECT: "single-select", // 单选
  MULTI_SELECT: "multi-select", // 多选
  BLANK: "blank", // 填空
  ANSWER: "answer", // 解答
  EN_ARTICLE: "en-article", // 英语作文
  CN_ARTICLE: "cn-article" // 语文作文
};

export const QUESTION_TYPE_OPTIONS = [
  {
    label: "单选题",
    value: QUESTION_TYPE_MAP.SINGLE_SELECT
  },
  {
    label: "多选题",
    value: QUESTION_TYPE_MAP.MULTI_SELECT
  },
  {
    label: "判断题",
    value: QUESTION_TYPE_MAP.JUDGE
  },
  {
    label: "填空题",
    value: QUESTION_TYPE_MAP.BLANK
  },
  {
    label: "解答题",
    value: QUESTION_TYPE_MAP.ANSWER
  },
  {
    label: "英语作文",
    value: QUESTION_TYPE_MAP.EN_ARTICLE
  },
  {
    label: "语文作文",
    value: QUESTION_TYPE_MAP.CN_ARTICLE
  }
];

// vuex本地存储关键字，尽量复杂，防止重复
export const VUEX_LS_KEY = "answer-card-vuex-ls-key-20190227";

export const cardHeadDataNoticeText =
  "<p>1. 答题前请将姓名、班级、学号填写清楚。</p><p>2. 选择题部分，必须使用<strong>2B铅笔</strong>填涂，修改前先用橡皮搽干净。</p><p>3. 非选择题部分，必须使用0.5毫米的黑色签字笔书写。</p><p>4. 必须在题号对应的答题区域作答，超出答题区域书写的答案无效。</p><p>5. 请保持答卷的清洁、完整，不要折叠答卷，禁用涂改液和涂改胶条。</p>";
export const cardHeadDataNoticeSimpleText =
  "<p>1. 答题前请将姓名、班级、学号填书写清楚。</p><p>2. 选择题请使用<strong>2B铅笔</strong>填涂，修改前先用橡皮擦干净。</p><p>3. 非选择题请使用黑色笔书写，答案不得超出答题框。</p><p>4. 请保持答卷的清洁、完整，不要折叠答卷。</p><p>5. 缺考标识由监考老师负责填涂。</p>";

const cardHeadData = (() => {
  const lineHtml = createHtmlSpace(18);
  const splitHtml = createHtmlSpace(4);
  const keySplitHtml = createHtmlSpace(2);
  return {
    uuid: "card-head-uuid",
    groupType: QUESTION_GROUP_TYPE_MAP.CARD_HEAD,
    title: "<strong>自定义标题</strong>",
    height: QUESTION_SIZE_MAP.cardHead.height,
    idBlankText: `<p>&nbsp;</p><p>姓${keySplitHtml}名: <u>${lineHtml}</u>${splitHtml}班${keySplitHtml}级: <u>${lineHtml}</u></p><p>&nbsp;</p><p>学${keySplitHtml}号: <u>${lineHtml}</u></p>`,
    noticeText: cardHeadDataNoticeText,
    idTitleText: "学号填涂区"
  };
})();

// 默认state数据
export const DEFAULT_STATE = {
  paperType: "A4",
  paperColCount: 1,
  questionGroupList: [],
  enableForbid: true,
  enableAB: true,
  enablePageFoot: false,
  pageFootTemplate: "$0",
  cardHead: cardHeadData,
  examIdType: "1",
  examIdCount: 8,
  qrcodeList: []
};

export const eventBusNames = {
  SHOW_SELECT_DIALOG: "show-select-dialog",
  SHOW_SELECT_SET_DIALOG: "show-select-set-dialog",
  SHOW_BLANK_DIALOG: "show-blank-dialog"
};
